;(function(){
    window.Sport = {
        template: `
        <div>
        <ul>
            <li v-for="sport in sportArr" :key="sport.id">
                <router-link :to="'/news/sport/detail/'+ sport.id">{{sport.title}}</router-link>
            </li>
        </ul>
        <!--详情-->
        <router-view></router-view>
        </div>  
        `,
        data() {
            return {
                sportArr: []
            }
        },
        methods: {
            getSportArr(){
                axios.get("http://localhost:8080/db/sport.json").then(response =>{
                    this.sportArr = response.data
                }).catch(error =>{
                    alert(error.message)
                })
            }
        },
        created() {
            this.getSportArr()
        },
    }
})()